import Vue from 'vue'
import VueRouter from 'vue-router'
import HomeView from '../views/HomeView.vue'
import userRoutes from './module/user'

//const Search = () =>
//  import(/* webpackchunkName: "group-search”*/'../views/Search.vue') 


Vue.use(VueRouter)

/*const originalpush = VueRouter.prototype.push
VueRouter.prototype.push = function push(location) {
  return originalpush.call(this, location).catch(err => err)
}*/

const routes = [
  {
    path: '/',
    name: 'home',
    component: HomeView
  },
  {
    path: '/about',
    name: 'about',
    component: () => import('../views/AboutView.vue')
  },
  ...userRoutes,
  //若需要增加路由，请在此处添加
  {
    path: '/blist',
    name: 'blist',
    component: () => import('../views/blogList.vue')
  },
  {
    path: '/bdetail',
    name: 'bdetail',
    component: () => import('../views/blogDetail.vue')
  },
  {
    path: '/userinfo',
    name: 'userinfo',
    component: () => import('../views/userInfo.vue')
  },
  {
    path: '/writeBlog',
    name: 'writeBlog',
    component: () => import('../views/WriteBlog.vue')
  },
  {
    path: '/deleteb',
    name: 'deleteb',
    component: () => import('../views/DeleteBlog.vue')
  },
  {
    path: '/Search',
    name: 'Search',
    component: () => import('../views/Search.vue')
  }
  //
]

const router = new VueRouter({
  mode: 'history',
  base: process.env.BASE_URL,
  routes
})

export default router
